package com.alibaba.otter.node.etl.load.loader.mq.rabbit.api;


import com.rabbitmq.client.Channel;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * RabbitMQ 健康检查
 *
 * @author dengchao
 */
//public class RabbitSelfCheck implements ISelfCheck {
//
//    @Override
//    public List<CheckResult> doHealthCheck() {
//        ChannelManager channelManager = new ChannelManager();
//        Collection<Channel> channels = channelManager.listChannels();
//        List<CheckResult> results = new ArrayList<>(channels.size());
//        for (Channel channel : channels) {
//            CheckResult result = new CheckResult();
//            result.setName("RabbitMQ");
//            result.setLevel("ERROR");
//            if (channel.isOpen()) {
//                result.setSuccess(true);
//            } else {
//                result.setSuccess(false);
//                result.setErrorMessage("RabbitMQ通道中断");
//            }
//            results.add(result);
//        }
//        return results;
//    }
//}
